import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from 'vue-axios'
import { 
	Carousel,
	CarouselItem,
	InputNumber,
	Button,
	RadioGroup,
	RadioButton,
	CollapseTransition,
	Message,
	MessageBox,
	Drawer
} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/publiccss/publiccss.css'
import less from 'less'
import { realPrice } from './utils/filters.js'

axios.defaults.baseURL = '/api';
Vue.config.productionTip = false;


// 使用less
Vue.use(less);
// 使用axios
Vue.use(VueAxios, axios);
// 使用element-ui
Vue.use(Carousel);
Vue.use(CarouselItem);
Vue.use(InputNumber);
Vue.use(Button);
Vue.use(RadioButton);
Vue.use(RadioGroup);
Vue.use(Drawer)
Vue.use(CollapseTransition);
Vue.prototype.$message = Message;
Vue.prototype.$messagebox = MessageBox;
// 注册过滤器 
Vue.filter('realPrice', realPrice);

// 额，书名
var tmp = []
axios.get('/search',{
				params:{
					'pageNum': '1',
					'pageSize': '10'
				}
			})
			.then((response) => {
				if (response.status == 200){
					for(let i of response.data.data){
						tmp.push(i.title)
					}
				}
			})
			.catch((err) => {
				console.log(err)
			})
Vue.prototype.$books_name = tmp;
Vue.prototype.$realPrice = realPrice;


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
